﻿using HC.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HC.View
{
    public partial class HCControlItem
    {

        #region 病历编辑元素背景色设置
        private bool FMouseActive;

        protected override void DoPaint(HCStyle aStyle, RECT aDrawRect, int aDataDrawTop, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo)
        {
            //重写DoPaint函数，使用病历元素存在背景色
            base.DoPaint(aStyle, aDrawRect, aDataDrawTop, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo);
            if (this.Active && !(aPaintInfo.Print))
            {
                aCanvas.Brush.Color = HC.clBtnFace;
                aCanvas.FillRect(aDrawRect);
            }
            else
            {
                if (FMouseActive)
                {
                    aCanvas.Brush.Color = HC.clBtnFace;
                    aCanvas.FillRect(aDrawRect);
                }
                else
                {
                    aCanvas.Brush.Color = HC.HCTransparentColor;
                    aCanvas.FillRect(aDrawRect);
                }
            }
        }

        public override void MouseEnter()
        {
            base.MouseEnter();
            FMouseActive = true;
        }

        public override void MouseLeave()
        {
            base.MouseLeave();
            FMouseActive = false;
        }

        #endregion

    }
}
